package com.github.codemperor.core.lock.bean;

/**
 * 使用锁后，业务是否执行的返回值
 * 注意 所有成功的code均为0，所有失败的code均为-1
 */
public enum LockResult {
    //成功执行
    OK(0, "Service Executed"),
    //等待解锁后执行成功
    OK_EXPIRED(0, "Service Executed after Lock Expired"),
    //执行失败
    FAILED(-1, "Service not Executed"),
    //等待解锁也没能执行，执行失败
    FAILED_EXPIRED(-1, "Service not Executed after Lock Expired"),
    ;

    private Integer code;
    private String message;

    LockResult(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
